import api from '../api/index'
import Vuex from 'vuex'

const initStore = () => {
  const state = {
    api,
    token: '',
    // areaCode: ''
  };
  const store = new Vuex.Store({
    state,
    mutations: {
      // 保存token 和 areaCode ， 所有组件都可以获取到
      changeToken (state, payload) {
        state.token = payload.token
      },
      // changeAreaCode (state, payload) {
      //   state.areaCode = payload.areaCode
      // }
    },
    getters: {},
    actions: {}
  });

  return store;
};

export default initStore;